<!--安检计划、抄表计划列表-->
<template>
  <div class="list-item-box">
    <div class="item" v-for="(item,index) in list" :key="index">
      <div class="title">{{item.street}}</div>
      <div class="tips" v-show="item.grid">{{item.grid}}</div>
      <div class="content">
        <dl>
          <dt>{{title.left}}</dt>
          <dd>{{item.inspector}}</dd>
        </dl>
        <!-- 抄表计划 -->
        <dl v-if="type == 'tabular'">
          <dt>{{title.phone}}</dt>
          <dd>{{item.phone}}</dd>
        </dl>
        <!-- 结束 -->
        <dl>
          <dt>{{title.centre}}</dt>
          <dd>{{item.contact}}</dd>
        </dl>
        <!-- 安检计划 -->
        <dl v-if="type == 'safety'">
          <dt>{{title.right}}</dt>
          <dd>{{item.chekDate}}</dd>
        </dl>
        <!-- 结束 -->
      </div>
      <div class="address">{{title.address}}：{{item.community}}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: '',
  props: {
    // 数据
    list: {
      type: Array,
      default: () => []
    },
    // 类型  safety：安检计划；tabular：抄表计划
    type: {
      type: String,
      default: ''
    },
  },
  components: {
  },
  data () {
    return {
      title: {},
      safety: {
        left: '安检员',
        centre: '联系电话',
        right: '安检时间',
        address: '安检小区'
      },
      tabular: {
        left: '抄表员',
        phone: '联系电话',
        centre: '抄表时间',
        right: '抄表户数',
        address: '地址'
      },
    };
  },
  created () { },
  methods: {

  },
  mounted () {
    var vm = this;
    if (vm.type == 'safety') {
      vm.title = vm.safety
    }
    if (vm.type == 'tabular') {
      vm.title = vm.tabular
    }
  },
};
</script>

<style lang="scss" scoped>
.list-item-box {
  .item {
    width: 100%;
    margin: 0 0 14px 0;
    border-radius: 8px;
    padding: 10px 14px;
    background: #fff;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    &:last-child {
      margin: 0;
    }
    .title {
      width: 100%;
      padding-left: 12px;
      line-height: 22px;
      font-size: 17px;
      position: relative;
      box-sizing: border-box;
      &::before {
        content: "";
        position: absolute;
        left: 0;
        top: 2px;
        width: 4px;
        height: 16px;
        border-radius: 4px;
        background: rgb(20, 98, 255);
        background: linear-gradient(
          0deg,
          rgba(20, 98, 255, 1) 0%,
          rgba(115, 161, 255, 1) 100%
        );
      }
    }
    .tips {
      display: inline-block;
      position: absolute;
      top: 0;
      right: 0;
      padding: 1px 8px 0;
      line-height: 22px;
      border-radius: 0 0 0 8px;
      font-size: 13px;
      color: #fff;
      background: rgb(20, 98, 255);
      background: linear-gradient(
        267deg,
        rgba(20, 98, 255, 1) 0%,
        rgba(123, 167, 255, 1) 100%
      );
    }
    .content {
      display: flex;
      justify-content: space-between;
      background: #f9f9f9;
      margin: 10px 0;
      dl,
      dt,
      dd {
        padding: 0;
        margin: 0;
      }
      dl {
        // width: 33.33%;
        padding: 10px;
        text-align: center;
        line-height: 24px;
        dt {
          font-size: 13px;
          color: #666;
        }
        dd {
          font-size: 15px;
          color: #222;
        }
      }
    }
    .address {
      font-size: 15px;
      line-height: 22px;
      color: #222;
    }
  }
}
</style>
